from gevent import monkey

monkey.patch_all()
import gevent
import requests
import time


def get_page(url):
    print("开始爬取!")
    response = requests.get(url)
    if response.status_code == 200:
        print('爬取成功!')

start_time = time.time()
gevent.joinall([
    gevent.spawn(get_page, 'https://www.baidu.com/'),
    gevent.spawn(get_page, 'http://news.baidu.com/'),
    gevent.spawn(get_page, 'https://baike.baidu.com/')]
)
stop_time = time.time()
print(stop_time-start_time)
print('--'*40)
